#!/bin/sh

##msgbox-----
#gdialog --title "Questionnaire" --msgbox "Welcom to my home" 9 18  #后面的数字表示宽高

##yesno------
#gdialog --title "Confirm" --yesno "Are you willing to take part" 45 90
#if [ $? != 0 ];then  #$?代码上一个命令的返回值。而0是唯一的正确值。
#    gdialog --infobox "Thank you anyway" 5 20
#    sleep 2
#    gdialog --clear
#    exit 0
#fi

##inputbox----
#gdialog --title "Questionnaire" --inputbox "please enter your name" 9 30 tianya >_1.txt #tianya 为默认值,_1.txt不存在则创建一个。
#name=$(cat _1.txt)   #$()调用外部命令
#echo $name

gdialog --menu "$name ,what music do you like best?" 25 50 4 1 "Classical" 2 "Jazz" 3 "Country" 4 "Other" 2> _1.txt
music=$(cat _1.txt)

if [ "$music" = "1" ];then
    gdialog --title "Likes Clasical" --msgbox "Good Choise!" 12 25
else
    gdialog --title "Doesn't like Clasical" --msgbox "shame!" 12 25
fi

sleep 2
gdialog --clear
exit 0
